Repository navigation
feat(bin): never day-pause the local Jev backend, switch it to Rizzo's native decisions API - #46
Merged
Merged
Conversation
added 2 commits
September 27, 2026 01:53
…s native decisions API The local backend has no monotonic quota to protect the way OpenRouter's daily spend cap does, so a load spike, a timeout, or an API/transport error now only skips that one row instead of pausing classification until the next calendar day; the very next drain tries again. Only an invalid config/jev-endpoint still pauses for the day, since that is a configuration mistake to surface rather than a transient condition to retry. The OpenRouter backend's day-pause behavior is unchanged. Also switch the local backend from the Jev-compatible /v1/systemone to Rizzo Flow's native /v1/decisions, with allow_abstain and a policy.min_top_probability of 0.6 (matching report's own --min-confidence default): a response the server itself could not decide, or answered under that confidence floor, carries no choice and is logged as doubt exactly like a low-confidence OpenRouter answer.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Intent
Follow-up to the just-merged local Rizzo Flow backend for bin/fm-jev.sh's shadow wake classifier (PR #45): (1) the local backend must never pause classification for the rest of the day for any reason - a high load reading, a timeout, or an API/transport error - unlike the OpenRouter backend, which keeps its existing day-long pause on timeout, API/transport error, missing cost, or reaching its daily spend cap; the local backend only skips the one affected row (logged with the reason) and the very next drain tries again; the sole exception, which still pauses the local backend for the day, is an invalid (non-loopback or path-carrying) config/jev-endpoint, since that is a configuration mistake to surface rather than a transient condition to retry. (2) Switch the local backend from the Jev-compatible /v1/systemone endpoint to Rizzo Flow's native /v1/decisions API (see the rizzo-flow skill, references/api.md), requesting the three-way handling question as an options array with policy.allow_abstain=true and policy.min_top_probability=0.6 (matching the existing report --min-confidence default of 0.6); a response the server itself could not decide (status insufficient_evidence) or answered under that confidence floor (status uncertain) carries no choice and must be logged as doubt, exactly like a low-confidence OpenRouter answer. The OpenRouter backend is unaffected by either change and keeps using /v1/systemone. Update docs/configuration.md's Jev shadow wake triage section and bin/fm-jev.sh's own header to match, and update/add bats-style shell tests in tests/fm-jev.test.sh (stubbed HTTP server) proving both behaviors, plus prove the local backend live against a real rizzo serve.
What Changed
bin/fm-jev.sh, a local-backend timeout, transport error, non-2xx HTTP response, or unreadable response now skips only that one row (logged aswhy=timeout/api-error, and a high load reading is still logged aswhy=load). Nothing is written tostate/jev/disabled, so the next drain tries again. After a timeout, the rest of that drain's rows are also skipped aswhy=timeoutwithout being sent, so a stuck server costs one timeout per drain. An invalid (non-loopback or path-carrying)config/jev-endpointstill pauses for the day. The OpenRouter backend still pauses for the day on a timeout, an API error, a missing cost, or hitting the spend cap, same as before./v1/decisionsinstead of/v1/systemone. It sends the three-way handling question as anoptionsarray withpolicy.allow_abstain=trueandpolicy.min_top_probability=0.6(JEV_LOCAL_MIN_TOP_PROBABILITY), and nomodelfield. A response without a valid choice (server statusinsufficient_evidenceoruncertain) is logged asdoubt. When there's noconfidencefield, confidence is read fromuncertainty.top_probability, and an object-shapedmodelis logged assource/weights/precision. OpenRouter keeps its/v1/systemonerequest shape; its question text now comes from the same shared constants.docs/configuration.mdnow describe both behaviours.tests/fm-jev.test.sh, which runs against a stubbed HTTP server, and the livetests/fm-jev-local-rizzo-live.test.share updated to cover the new request body, the no-pause behaviour and the doubt mapping.🤖 Generated with Claude Code
Risk Assessment
✅ Low: The change is bounded to the local shadow-only classifier, which never holds or changes a wake. The /v1/decisions request and response mapping matches the documented Rizzo Flow API, the OpenRouter paths are unchanged, and the remaining concerns are a confirmation on intent wording and an overstated doc sentence.
Testing
No baseline commands had run before this step. I ran the targeted stubbed suite tests/fm-jev.test.sh (all 24 pass) and the opt-in live test against the real
rizzo serveon 127.0.0.1:8017 (passes). I also ran a scenario script by hand through the real wake drain. It recorded the actual native request sent to /v1/decisions and showed server-side uncertain answers logged as doubt. It showed that a hung server, a refused port, an HTTP 500 and a high load each skip with why=timeout, api-error or load, never write state/jev/disabled, and are classified again on the next drain. The invalid-endpoint case is the only one that pauses for the day. I saved the evidence as CLI transcripts in the evidence directory. There is no UI surface, so no screenshots. The overall result is a pass, and the temporary directories were removed with the worktree left clean.Evidence: Live rizzo serve test transcript
Source: Live rizzo serve test transcript
Evidence: Hand-run scenarios against real rizzo, hung, refused, HTTP 500, load and invalid endpoint (shadow log rows plus the captured /v1/decisions request)
Source: Hand-run scenarios against real rizzo, hung, refused, HTTP 500, load and invalid endpoint (shadow log rows plus the captured /v1/decisions request)
Evidence: Script that produced the scenario transcript
Source: Script that produced the scenario transcript
Evidence: Native request body and real rizzo answer (excerpt)
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
bin/fm-jev.sh:375- This change removes the local backend's only circuit breaker, so a server that hangs can now keep a pile of classifier processes alive with no limit. Before, the first timeout wrote state/jev/disabled and every later row and drain skipped quickly. Now arizzo servethat accepts connections but never answers (model stuck, or its one-at-a-time queue backed up behind abandoned requests) costs JEV_TIMEOUT seconds (default 5) per row. The detached observe-drain holds JEV_LOCK for the whole time. Every later drain spawns another detached observer that spins in fm_lock_acquire_wait (bin/fm-wake-lib.sh:886), polling every 0.1s with no upper bound. If wakes arrive faster than one row per timeout, the waiting processes and their backlog grow without limit. Also, curl giving up does not cancel the server-side work, which can keep the server's serial queue saturated and make every later request time out too. The only thing that stops the growth is the load ceiling, and only once the pile-up itself pushes the 1-minute load to 8. The intent explicitly requires 'never pause ... for a timeout', so the behaviour is authorized. Any remedy changes that behaviour and needs the author's decision, for example: skip the rest of the current spool after the first local timeout (logged with why=timeout, next drain retries), or make the local observer give up if it cannot get JEV_LOCK within a bounded time.docs/configuration.md:620- The docs still describe the local backend as working with 'a Jev-compatible server, such as Rizzo Flow's rizzo serve'. The same wording is in the bin/fm-jev.sh header at lines 3 and 20, and in the tests/fm-jev.test.sh fake-curl comment at line 35. The backend now only calls Rizzo Flow's native POST /v1/decisions, which uses a strict schema: an options array plus policy. A Jev/TypeSafe-compatible server that only has /v1/systemone would answer 404/422 on every row, and each row would be skipped silently as api-error with no pause and nostatushint. Change the wording to say a Rizzo Flow server (native /v1/decisions) is required.tests/fm-jev.test.sh:400- The intent requires the local backend to skip the affected row 'logged with the reason'. test_local_backend_timeout_and_api_errors_skip_without_a_day_pause only checks that the next row was attempted (calls == 2) and that state/jev/disabled is absent. It never checks that the log has a skipped row with why=timeout (for mode timeout) or why=api-error (for http500 and refused). Add a jev_events check, e.g.select(.outcome == "skipped" and .why == "timeout"), so the test proves the logged-reason half of the requirement.🔧 Fix: Skip rest of local drain after timeout; fix docs and tests
2 issues (1 warning, 1 info) still open:
bin/fm-jev.sh:496- The fix round changed a local timeout from skipping one row to skipping the rest of that drain. The intent says the local backend "only skips the one affected row (logged with the reason) and the very next drain tries again". The new hunk (if [ -n "$JEV_LOCAL_TIMED_OUT" ]; then jev_log_skip "$id" timeout "an earlier row in this drain got no answer..."; continue; fi) makes one timeout skip every later row in the same spool without dialing. The test now asserts calls == 1 for two queued rows. This is one of the two remedies the round-1 finding suggested, and the user chose to fix that finding. But it changes the literal row-level contract, and the user did not pick between the two remedies. Please confirm that skipping the rest of the drain is acceptable. The other option was a bounded wait on JEV_LOCK, which keeps per-row skipping.docs/configuration.md:633- The docs say detached drains "never pile up" behind a stuck server, and the header says the lock is "never held long enough" for them to pile up (bin/fm-jev.sh:66-68). Neither claim is true. Every new drain still dials first, so each one spends a full JEV_TIMEOUT (5s by default) holding JEV_LOCK. Other detached observers still wait on it with no time limit in fm_lock_acquire_wait (bin/fm-wake-lib.sh:886). Example: while the server hangs, drains arrive every 2s. Each holds the lock for about 5s, so waiting observers pile up without limit, just more slowly than before. Reword both places to say what the fix actually guarantees: at most one timeout per drain instead of one per row. Fully bounding the pile-up across drains would need new cross-drain backoff state or a bounded lock wait, which is a separate decision.✅ **Test** - passed
✅ No issues found.
bash tests/fm-jev.test.sh: all 24 stubbed-HTTP tests pass. This includes the newtest_local_backend_uncertain_maps_to_doubtandtest_local_backend_timeout_and_api_errors_skip_without_a_day_pause, the updated native-request assertions, and the unchanged OpenRouter day-pause tests (timeout, API error, cap)FM_JEV_RIZZO_LIVE=1 bash tests/fm-jev-local-rizzo-live.test.shagainst a realrizzo serveon 127.0.0.1:8017: passes, classified in about 400ms with model=XHToken/Spark-X2.5-1.7B/flow/q8_0 and cost=nullHand-run scenarioROOT=$PWD bash ~/.no-mistakes/evidence/01M3G279V6NYZF9PS0HW79TEVC/live-scenarios.sh. It drives the real bin/fm-wake-drain.sh with a curl wrapper that records each request (1) against the real rizzo server: dials /v1/decisions, the body has no model field, sends options [firstmate, absorbable, captain] and policy {allow_abstain:true, min_top_probability:0.6}; answers under the confidence floor (the raw answer shows status=uncertain, choice=null) are logged as doubt, and a captain-worthy wake is classified as captain at 0.99Hand-run scenario (2) a hung loopback server with jev-timeout=2: one request, all 3 rows logged as skipped why=timeout, no state/jev/disabled; the very next drain in the same home classifiedHand-run scenario (3) a refused loopback port and (4) a stub server returning HTTP 500: every row was tried and logged as skipped why=api-error, no day pause, and the next drain classifiedHand-run scenario (5) the real load reading above config/jev-max-load=0.01: no request sent, logged why=load, no day pause; the next drain with the ceiling raised classifiedHand-run scenario (6) endpoints http://10.0.0.5:8017 and http://127.0.0.1:8017/v1: never dialed, logged why=invalid-endpoint, state/jev/disabled was written, and the later row was skipped why=disabled (the only day pause)fm-jev.sh statuson the local-backend home: reports the endpoint, load ceiling and timeout✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.